package com.rzico.order.enumx;

/**
 * Created by icssh on 2020/4/11.
 */
public enum OrderShippingStatusEnum {
    /**
     * 订单配送状态(0.未发货,1.已发货,2.待退货,3.已退货)
     */
    SHIPPING_STATUS_UNSHIPPNG(0, "未发货"),
    SHIPPING_STATUS_SHIPPNG(1, "已发货"),
    SHIPPING_STATUS_WAIT_REFUND_SHIPPING(2, "待退货"),
    SHIPPING_STATUS_REFUND_SHIPPING(3, "已退货");

    private Integer id;
    private String name;

    OrderShippingStatusEnum(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return this.id;
    }

    public String getName() {
        return this.name;
    }

    public static String getNameById(Integer id){
        if (id == null) {
            return null;
        }
        OrderShippingStatusEnum anEnum = getById(id);
        if (anEnum == null) {
            return null;
        }
        return anEnum.getName();
    }

    public static OrderShippingStatusEnum getById(Integer id) {
        for (OrderShippingStatusEnum anEnum : values()) {
            if (anEnum.getId().equals(id)) {
                return anEnum;
            }
        }
        return null;
    }

}
